package com.lichuang.dedao.curriculum.service.impl;

import com.lichuang.dedao.curriculum.entity.Curriculum;
import com.lichuang.dedao.curriculum.mapper.CurriculumMapper;
import com.lichuang.dedao.curriculum.service.ICurriculumService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 课程 服务实现类
 * </p>
 *
 * @author xiaosong
 * @since 2019-07-15
 */
@Service
public class CurriculumServiceImpl extends ServiceImpl<CurriculumMapper, Curriculum> implements ICurriculumService {

    @Autowired
    private CurriculumMapper curriculumMapper;

    @Override
    public Integer updateCurriculumStatusById(Integer id,Integer status) {
        if(curriculumMapper.selectById(id) != null){
            return curriculumMapper.updateCurriculumStatusById(id,status);
        }
        return -1;
    }

    @Override
    public List<Curriculum> getNewestCurriculum(){
        return curriculumMapper.getNewestCurriculum();
    }
}
